home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -websites- / haage&partner / ftp / classx / fm3-demo.lha / FM3-DEMO / Rexx / ShowProjects.rexx < prev    next >
OS/2 REXX Batch file  |  1997-08-29  |  3KB  |  132 lines

  1. /******************************************************************/
  2. /* ClassX Amiga Rexx script - Copyright © 1997 ClassX Development */
  3. /******************************************************************/
  4.  
  5. /*
  6.     $VER: ShowProjects.rexx 3.0
  7. */
  8.  
  9. /*
  10. #ITA "Mostra i Progetti"
  11. #INF "Mostra tutti i progetti della directory 'FontMachine:Projects'."
  12. #INF "- Descrizione:"
  13. #INF "  La macro esegue una scansione della directory 'FontMachine:Projects'"
  14. #INF "  cercando e visualizzando i progetti di FontMachine."
  15. #INF "- Uso:"
  16. #INF "  Dopo il caricamento di ogni progetto, FontMachine apre un requester"
  17. #INF "  mostrando il nome del file relativo. A questo punto, cliccando 'Ok'"
  18. #INF "  si continua la scansione. 'Stop' blocca l'esecuzione dello script."
  19. #END
  20. */
  21.  
  22. /*
  23. #ENG "Show Projects"
  24. #INF "Shows all the projects in the 'FontMachine:projects' dir."
  25. #INF "- Description:"
  26. #INF "  The macro scans the 'FontMachine:Projects' searching for suitable"
  27. #INF "  FontMachine projects to show."
  28. #INF "- Usage:"
  29. #INF "  For each project, FontMachine opens a requester showing the name."
  30. #INF "  Now it's possible to stop the script with the 'Stop' button, or"
  31. #INF "  proceed to the next project clicking 'Ok'."
  32. #END
  33. */
  34.  
  35.  
  36. MYPORT = 'FontMachine'
  37.  
  38. IF ~SHOW('P', MYPORT) THEN DO
  39.     IF EXISTS('FontMachine:FontMachine') THEN DO
  40.         ADDRESS COMMAND 'Run >NIL: FontMachine:FontMachine'
  41.         DO 30 WHILE ~SHOW('P',MYPORT)
  42.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  43.         END
  44.     END
  45.     ELSE DO
  46.         SAY "FontMachine could not be loaded."
  47.         EXIT 10
  48.     END
  49. END
  50.  
  51. IF ~SHOW('P', MYPORT) THEN DO
  52.     SAY 'FontMachine Rexx port could not be opened.'
  53.     EXIT 10
  54. END
  55.  
  56. ADDRESS VALUE MYPORT
  57. OPTIONS RESULTS
  58. OPTIONS FAILAT 10000
  59.  
  60. /* Make sure rexxsupport library is opened */
  61. IF ~SHOW('L','rexxsupport.library') THEN CALL ADDLIB('rexxsupport.library',0,-30)
  62.  
  63. SIGNAL ON Break_C
  64. SIGNAL ON Break_D
  65.  
  66. /******************************************************************/
  67.  
  68. LockGui
  69.  
  70. /* set relevant paths for projects and temp files */
  71. PrjDir = 'FontMachine:Project/'
  72.  
  73. /* scan the projects dir */
  74. Files = SHOWDIR(PrjDir,'f',"|")
  75. fLength = LENGTH(Files)
  76.  
  77. nList=0
  78. DO WHILE fLength>0
  79.     cLength=pos('|',Files)
  80.     IF cLength=0 THEN DO
  81.         cLength=FLength+1
  82.         fLength=0
  83.     END
  84.     cFile = LEFT(Files,cLength-1)
  85.     pFile = PrjDir||cFile
  86.  
  87.     /* load the project */
  88.     FreeFont
  89.     FreeTexture Front
  90.     FreeTexture Border
  91.     LoadProject pFile
  92.  
  93.     IF RC=0 THEN DO
  94.         CALL WaitRender
  95.         Request '"FontMachine"' '"Project: '||cFile||'"' 'Ok|Stop'
  96.     END
  97.     ELSE Request '"FontMachine"' '"'FM_ERROR'"' 'Ok'
  98.  
  99.     /* check if user has stopped the script */
  100.     IF FM_RESULT=0 THEN FLength = 0
  101.  
  102.     /* next project */
  103.     if FLength~=0 then Files=right(Files,fLength-cLength)
  104.     fLength=fLength-cLength
  105. end
  106.  
  107. Request '"FontMachine"' '"End"' 'Ok'
  108.  
  109. UnLockGui
  110.  
  111. /******************************************************************/
  112.  
  113. WaitRender: PROCEDURE
  114.     /* wait the rendering of the font */
  115.     DO FOREVER
  116.         CheckRedraw
  117.         if FM_RESULT ~= 0 then ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  118.         else LEAVE
  119.     END
  120. RETURN
  121.  
  122. /******************************************************************/
  123.  
  124. /* break handlers */
  125. Break_C:
  126. Break_D:
  127.     UnLockGui
  128.     Request '"FontMachine"' '"Procedure Stopped"' 'Ok'
  129. RETURN
  130.  
  131. /******************************************************************/
  132.